<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta charset="utf-8">
	<title>后台用户管理</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="./layui/css/layui.css" media="all">
	<style>
		.blogUser-con .layui-table-view {
			border: none;
		}
		
		.blogUser-con .layui-table-box {
			margin-top: 10px;
		}
		
		.blogUser-con {
			padding: 0 15px 15px 15px;
			margin-bottom:50px;
		}
		.blogUser-con  .layui-table-tool-self{
			display:none;
		}
		.blogUser-con .not_border_left {
			border-left: none !important;
		}
		
		.blogUser-con .blogUser dl dd.layui-this {
			background-color: #1E9FFF !important;
		}
		
		.blogUser-con .hide {
			display: none;
		}
		
		.blogUser-con .show {
			display: block;
		}
		
		.blogUser-con .btn_size {
			height: 28px !important;
			line-height: 28px !important;
		}
		
		.blogUser-con .layui-table-body table tbody .layui-table-hover {
			background: #fffdd3 !important;
		}
		
		.blogUser-con .layui-table-body table tbody .layui-table-click {
			background: #fdef9b !important;
		}
		
		.blogUser-con .layui-table, .layui-table-view {
			border: none;
			margin-top: 0;
		}
		
		#add-blogUser {
			display: none;
			z-index: 999 !important;
		}
		
		#add-blogUser .artTypeLayer {
			width: 90%;
			margin-left: auto;
			margin-right: auto;
			padding-top: 20px;
		}
		.adminuserdetail{
			padding:20px;
			display: none;
		}
		.adminuserdetail table tr td{
			padding: 15px;text-align: center;
		}
		.adminuserdetail .tdbck{
			background: #f2f2f2;
			width: 30%;
		}
	</style>
</head>
<body>

	<div class="blogUser-con">
		<blockquote class="layui-elem-quote not_border_left">
			<form class="layui-form" action="">
			    <div class="layui-inline">
	     	   		<select id="logtype" name="logtype">
						  <option value="">请选择日志类型</option>
						  <option value="add">添加</option>
						  <option value="modify">修改</option>
						  <option value="delete">删除</option>
						  <option value="query">查询</option>
					</select> 
			    </div>
			    <div class="layui-input-inline">
					<input type="text" name="sysmethod" id="sysmethod" placeholder="请输入操作的系统方法" class="layui-input" autocomplete="off">
			    </div>
			    <div class="layui-input-inline">
					<input type="text" name="sysname" id="sysname" placeholder="请输入操作用户名" class="layui-input" autocomplete="off">
			    </div>
			    
			    <div class="layui-inline">
			      <label class="layui-form-label">操作时间</label>
			      <div class="layui-input-inline">
			        <input type="text" name="date" id="date" lay-verify="date" placeholder="yyyy-MM-dd HH:mm:ss" autocomplete="off" class="layui-input">
			      </div>
			    </div>
			 
			    
			    <div class="layui-inline">
	     	   		<button id="btnselfrontinfo" type="button" class="layui-btn layui-bg-blue">查询</button>
			    </div>
			    
			    <div class="layui-inline">
	     	   		<button id="deleteAllLog" type="button" class="layui-btn layui-bg-blue">清理日志</button>
			    </div>
				
			</form>
		</blockquote>
		
		<script type="text/html" id="barDemo">
			<a class="layui-btn layui-btn-xs" id="edit" lay-event="edit">编辑</a>
			<a class="layui-btn layui-btn-danger  layui-btn-xs" lay-event="delete">删除</a>
		</script>

		<!-- 表格开始 -->
		<table class="layui-hide" name="blogUser" id="blogUser" lay-filter="blogUser"></table>
		<!-- 表格结束 -->
		
	</div>
	<script src="./js/jquery-3.3.1.js" charset="utf-8"></script>
	<script src="./layui/layui.js" charset="utf-8"></script>
	<script src="./js/loadselect.js" charset="utf-8"></script>
	<script>
	layui.use([ 'table', 'form', 'layer',  'laytpl', 'element','layedit', 'laydate' ], function() {
		var table = layui.table, form = layui.form, 
			layer = layui.layer, $ = layui.jquery,
			element = layui.element;
			layedit = layui.layedit;
  			laydate = layui.laydate;
		 
		 //日期
		  laydate.render({
		    elem: '#date'
		    ,type: 'datetime'
		  });
		  laydate.render({
		    elem: '#date2'
		    ,type: 'datetime'
		  });
	
	
	function localFormatter(value) {
        if (value.trim() == "add") {
            return "<span class='label'  style='color:#993366'>添加</span>";
        } else if (value.trim() == "modify") {
            return "<span class='label'  style='color:#993366'>修改</span>";
        } else if (value.trim() == "delete") {
            return "<span class='label'  style='color:#993366'>删除</span>";
        }else if (value.trim() == "query") {
            return "<span class='label'  style='color:#993366'>查询</span>";
        }
    }
	
		/*加载表格*/
		table.render({
			elem : '#blogUser',
			id:'blogUserid',
			url : 'systemlog/getsystemloglist',
			title : '后台用户数据表',
			height: "full-160",
			skin : 'line',
			even : true,
			cols : [
					[ {
						field : 'id',
						align : 'center',
						title : '编号',
					}, {
						field : 'opertype',
						align : 'center',
						title : '日志类型',
						width : 150,
						templet:function(d){
    		 			 return localFormatter(d.opertype)}
					}, {
						field : 'description',
						title : '描述',
						align : 'center'
					}, {
						field : 'opermethod',
						align : 'center',
						title : '系统方法'
					}, {
						field : 'createby',
						align : 'center',
						title : '用户角色',
					}, {
						field : 'params',
						align : 'center',
						title : '参数',
					}, {
						field : 'createdate',
						align : 'center',
						title : '创建时间',
						width : 200,
						templet : "<div>{{layui.util.toDateString(d.createdate, 'yyyy-MM-dd HH:mm:ss')}}</div>"
					}, {
						field : 'createby',
						align : 'center',
						title : '角色描述',
					} ]
				],
			 page: {
					layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'],
					groups: 5,
					limit: 10,
					limits: [10, 20, 30, 40, 50],
					theme: '#1E9FFF',						
			 },
		});
		
		/* 点击查询对网站用户进行筛选 */
		$("#btnselfrontinfo").click(function(){
			var logtype=$("#logtype").val().trim();
			var sysmethod=$("#sysmethod").val().trim();
			var sysname=$("#sysname").val().trim();
			var date=$("#date").val();
	
			//alert(logtype)
			prarm = '?logtype=' + logtype + '&sysmethod=' + sysmethod+ '&sysname=' 
							+ sysname + '&date=' + date;
			
			table.render({
				elem : '#blogUser',
				id:'blogUserid',
				url : 'systemlog/getsystemloglist' + prarm,
				title : '后台用户数据表',
				height: "full-160",
				skin : 'line',
				even : true,
				cols : [
					[ {
						field : 'id',
						align : 'center',
						title : '编号',
					}, {
						field : 'opertype',
						align : 'center',
						title : '日志类型',
						width : 150,
						templet:function(d){
    		 			 return localFormatter(d.opertype)}
					}, {
						field : 'description',
						title : '描述',
						align : 'center'
					}, {
						field : 'opermethod',
						align : 'center',
						title : '系统方法'
					}, {
						field : 'createby',
						align : 'center',
						title : '用户角色',
					}, {
						field : 'params',
						align : 'center',
						title : '参数',
					}, {
						field : 'createdate',
						align : 'center',
						title : '创建时间',
						width : 200,
						templet : "<div>{{layui.util.toDateString(d.createdate, 'yyyy-MM-dd HH:mm:ss')}}</div>"
					}, {
						field : 'createby',
						align : 'center',
						title : '角色描述',
					} ]
				],
				 page: {
						layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'],
						groups: 5,
						limit: 10,
						limits: [10, 20, 30, 40, 50],
						theme: '#1E9FFF',						
				 },
			});
		});
		//结束
		
		
		
		
		//删除开始
		$("#deleteAllLog").click(function(){
		 	layer.confirm('真的删除行么', function(index){
		  		layer.close(index);
		      //向服务端发送删除指令
		      	$.post("systemlog/deleteAllLog",function(flag){
	    			if(flag){
	    				layer.msg("刪除成功",{icon:6}); 
				        table.reload('blogUserid'); 
	    			}else{
	    				layer.msg("刪除失敗",{icon:5});
	    			}
	    			
	    		})
	    		
		 	})		
		})
	})
	</script>
</body>
</html>